package com.imoonfish.bet;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;

import com.imoonfish.bet.adapter.FruitAdapter;
import com.imoonfish.bet.entity.Fruit;

import java.util.ArrayList;
import java.util.List;

public class Menu extends AppCompatActivity {
    private List<Fruit> fruitList=new ArrayList<>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menu);
        initFruit();
        FruitAdapter fruitAdapter=new FruitAdapter(Menu.this,R.layout.fruit_item,fruitList);
        ListView listView=(ListView)findViewById(R.id.show_fruit);
        listView.setAdapter(fruitAdapter);

    }
    public void initFruit(){
        for (int i=0;i<2;i++){
            Fruit apple=new Fruit("Apple",R.drawable.apple);
            fruitList.add(apple);
            Fruit banana=new Fruit("banana",R.drawable.banana);
            fruitList.add(banana);
            Fruit cherry=new Fruit("cherry",R.drawable.cherry);
            fruitList.add(cherry);
            Fruit grape=new Fruit("grape",R.drawable.grape);
            fruitList.add(grape);
            Fruit watermelon=new Fruit("watermelon",R.drawable.watermelon);
            fruitList.add(watermelon);
            Fruit kiwis=new Fruit("kiwis",R.drawable.kiwis);
            fruitList.add(kiwis);
        }
    }
}
